//
//  RootTabBarViewController.swift
//  StudyDY
//
//  Created by yinchangming on 2018/6/29.
//  Copyright © 2018年 yinchangming. All rights reserved.
//

import UIKit

class RootTabBarViewController: UITabBarController {

    var titles=["首页","直播","关注","我的"]
    var picArray=["btn_home","btn_column","btn_live","btn_user"]
    var vcCotroller=[HomeViewController(),LiveViewController(),FllowViewController(),MineViewController()]
    var naVController=Array<BaseNavigationController>()
    override func viewDidLoad() {
        super.viewDidLoad()

        for index in 0...titles.count-1{
            naVController.insert(getNavController(title: titles[index], vc:  vcCotroller[index], image: picArray[index]), at: index)
        }
        self.viewControllers = naVController
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    
    }
    func getNavController(title:String,vc:BaseViewController,image:String)->BaseNavigationController{
        let nav = BaseNavigationController(rootViewController: vc)
        nav.tabBarItem=UITabBarItem(title: title, image: UIImage(named: image), selectedImage: UIImage(named: "\(image)_selected"))
        vc.navigationItem.title=title
        vc.view.backgroundColor=UIColor.white
        return nav
    }

}
